<%@ page contentType="text/html; charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>提案系统</title>
<link href="${ctx}/css/main/base.css" rel="stylesheet" type="text/css"/>
<link href="${ctx}/css/main/main.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="${ctx}/scripts/sys/calendar.js"></script>
</head>
<body class="m_r">
<form action="${ctx}/user/user_modify.action" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="tab_m left">
  <tr>
    <td colspan="5" class="zctop left"><span class="font14 zc_bt">个人资料</span></td>
  </tr>
  <tr>
    <td colspan="5" class="bg1 font14">基本信息</td>
  </tr>
  <tr>
    <td width="12%" class="bg5 right">姓　　名：</td>
    <td width="15%">${user.userName}</td>
    <td width="12%" class="bg5 right">界　　别：</td>
    <td width="15%">
    <pro:option selectName="user.jieBie" optionName="jieBie" value="${user.jieBie}"/>
    </td>
    <td width="12%" rowspan="5" align="center" valign="middle" class="bg5 right">
      <table width="100%" border="0" cellspacing="0" cellpadding="0" >
       <tr>
          <td align="center" valign="middle">
           <div id="newPreview" style="width: 100px;height: 125px;vertical-align: middle;border:0px solid red;vertical-align: middle;">
		    <img id="view" <s:if test="user.photo!=null">src="${ctx }/upload/file/BaseUser/${user.photo}"</s:if><s:else>src="${ctx }/images/main/trainer.gif"</s:else> width="100" height="125" class="videoimg" />
	       </div>
	     </td>
       </tr>
      </table>

   </td>
  </tr>
   <tr>
    <td class="bg5 right">身份证号：</td>
    <td><input type="text" id="userCard" name="user.userCard" value="${user.userCard}" onblur="showBirthday(document.all.userCard.value);" class="fl_l"/><div id="code"></div></td>
     <td class="bg5 right">届　　次：</td>
     <td><input type="text" id="jieCi" name="user.jieCi" value="${user.jieCi}"  class="fl_l"/>
     </td> 
  </tr>
  <tr>
    <td class="bg5 right">性　　别：</td>
    <td><pro:option selectName="user.userSex" optionName="userSex" value="${user.userSex}"/></td>
    <td class="bg5 right">民　　族：</td>
    <td><input type="text" id="national" name="user.national" value="${user.national}"  class="fl_l"/></td>    
  </tr>
  <tr>
    <td class="bg5 right">出生日期：</td>
    <td><input type="text" name="user.userBirthday" id="birthday" value="<s:date name="user.userBirthday" format="yyyy-MM-dd"/>"/>
    <img src="${ctx}/images/main/calendar.gif" align="absMiddle" border="0" style="cursor:hand" onclick="setday(this,document.all.birthday)"></td>
    <td class="bg5 right">籍　　贯：</td>
    <td><input type="text" id="birthPlace" name="user.birthPlace" value="${user.birthPlace}"  class="fl_l"/></td>
  </tr>
  <tr>
    <td class="bg5 right">学　　历：</td>
    <td><input type="text" id="education" name="user.education" value="${user.education}"  class="fl_l"/></td>
    <td class="bg5 right">政治面貌：</td>
    <td><input type="text" id="political" name="user.political" value="${user.political}"  class="fl_l"/></td>
  </tr>
  <tr>
    <td class="bg5 right">工作单位：</td>
    <td><input type="text" id="workUnit" name="user.workUnit" value="${user.workUnit}"  class="fl_l"/></td>
    <td class="bg5 right">照　　片：</td>
    <td colspan="3"><input id="file" name="photo"  type="file" id="photo" class="input01" maxlength="200"  size="35"  onchange="javascript:PreviewImg(this);"  />
    </td>
  </tr>

  <tr>
    <td class="bg5 right">职　　务：</td>
    <td><input type="text" id="post" name="user.post" value="${user.post}"  class="fl_l"/></td>
    <td class="bg5 right">联系电话：</td>
    <td colspan="3" ><input id="userPhone" type="text" name="user.userPhone" value="${user.userPhone}" class="fl_l"/><div id="errPhone"></div>
    </td>
  </tr>
  <tr>
    <td class="bg5 right">邮　　编：</td>
    <td><input type="text" id="zipCode" name="user.zipCode" value="${user.zipCode}"  class="fl_l"/></td>
    <td class="bg5 right">电子邮件：</td>
    <td colspan="3" ><input type="text" name="user.userEmail" value="${user.userEmail}" class="fl_l"/><div id="errEmail"></div></td>
  </tr>
    <tr>
    <td class="bg5 right">联系地址：</td>
    <td colspan="2" ><input type="text" id="address" name="user.address" value="${user.address}"  class="fl_l"/></td>
    <td colspan="3" ></td>
  </tr>
  <tr>
  <input type="hidden" name="user.userId" value="${user.userId}"/>
  <input type="hidden" name="user.userLogin" value="${user.userLogin}"/>
  <input type="hidden" name="user.userPwd" value="${user.userPwd}"/>
  <input type="hidden" name="user.userOrder" value="${user.userOrder}"/>
  <input type="hidden" name="user.userName" value="${user.userName}"/>
  <input type="hidden" name="user.userSpell" value="${user.userSpell}"/>
  <input type="hidden" name="user.userAlias" value="${user.userAlias}"/>
  <input type="hidden" name="user.roleId" value="${user.roleId}"/>
  <input type="hidden" name="user.roleIdOther" value="${user.roleIdOther}"/>
  <input type="hidden" name="user.deptId" value="${user.deptId}"/>
  <input type="hidden" name="user.deptIdOther" value="${user.deptIdOther}"/>
  <input type="hidden" name="user.userFlag" value="${user.userFlag}"/>
  <input type="hidden" name="user.userMemo" value="${user.userMemo}"/>
  <input type="hidden" name="user.photo" value="${user.photo}"/>
  <input type="hidden" name="user.system" value="${user.system}"/>
  
    <td colspan="6" class="hei_1 center"><input type="button" onclick="modifyInfo();" value="修 改" class="log_f zc_b">
	<input type="button" value="返 回" class="log_f zc_b">	</td>
  </tr>
</table>
</form>
</body>
</html>

<script type="text/javascript" src="${ctx}/scripts/commons/validation.js"></script>
<script type="text/javascript">
<!--
function inntBycode(){
	var code = document.getElementById("userCard").value;
	if(code.length > 0){
				var innitUrl = "${ctx}/user/user!innitByCode.action";
				var parm = "user.userCard=" 
							+ code
							+ "&time=" 
							+ new Date().getTime();
				$.ajax(
				{
					type:"POST",
					url:innitUrl,
					data:parm,
					dataType:"json",
					success:function(json) {
						var user = json.baseUser;
					if(user.userBirthday == null || user.userSex == null){
						document.getElementById("code").innerHTML = "请正确输入身份证号码!";
					}else{
						document.getElementById("birthday").value = user.userBirthday;
						document.getElementById("user.userSex").value = user.userSex;
					}
					
					},
					error:function(){
						alert("系统故障，添加分类失败！！！");
					}
				});
		}	
}

function modifyInfo(){
	var userPhone = document.getElementById("user.userPhone").value;
	var userEmail = document.getElementById("user.userEmail").value;
	if(userPhone.length > 0 && !isAllNumber(userPhone)){
		document.getElementById("errPhone").innerHTML = "<font color='red'> 正确填写手机号码!</font>";
		return false;
	}
	if(userEmail.length > 0 && isEmail(userEmail) == false){
		document.getElementById("errEmail").innerHTML = "<font color='red'> 正确填写电子邮箱!</font>";
		return false;
}
document.forms[0].submit();
}


//根据身份证，获得性别和出生年月
　　 function showBirthday(val)
　　 {
 	if((/^\d{18}|\d{17}[xX]{1}|\d{15}$/).test(val)){

		var birthdayValue;
	　　 if(15==val.length)
	　　 { //15位身份证号码
	　　 birthdayValue = val.charAt(6)+val.charAt(7);
	　　 if(parseInt(birthdayValue)<10)
	　　 {
	　　 birthdayValue = '20'+birthdayValue;
	　　 }
	　　 else
	　　 {
	　　 birthdayValue = '19'+birthdayValue;
	　　 }
	　　 birthdayValue=birthdayValue+'-'+val.charAt(8)+val.charAt(9)+'-'+val.charAt(10)+val.charAt(11);
	　　 if(parseInt(val.charAt(14)/2)*2!=val.charAt(14))
	    document.getElementById("user.userSex").value=0;
	    else
		document.getElementById("user.userSex").value=1;
		document.getElementById("user.userBirthday").value= birthdayValue;
	　　 }
	　　 if(18==val.length)
	　　 { //18位身份证号码
	　　 birthdayValue=val.charAt(6)+val.charAt(7)+val.charAt(8)+val.charAt(9)+'-'+val.charAt(10)+val.charAt(11) 
	　　 +'-'+val.charAt(12)+val.charAt(13);
	　　 if(parseInt(val.charAt(16)/2)*2!=val.charAt(16))
	    document.getElementById("user.userSex").value=0;
	    else
		 document.getElementById("user.userSex").value=1;
	　　 document.getElementById("user.userBirthday").value= birthdayValue;
	　　 }
	}else{
		document.getElementById("code").innerHTML = "<font color='red'> 请正确输入身份证号码!</font>";
	}
　　 }
//-->
</script>